package com.zxy.ziems.server.production.service.impl;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.zxy.ziems.server.mybatis.core.service.ServiceImplX;
import com.zxy.ziems.server.production.mapper.CustXyhCompleterptMapper;
import com.zxy.ziems.server.production.mapper.CustXyhViewMapper;
import com.zxy.ziems.server.production.pojo.entity.CustXyhCompleterptEntity;
import com.zxy.ziems.server.production.service.CustXyhCompleterptService;
import com.zxy.ziems.server.service.DictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * @Copyright (C),
 * @ClassName: CustXyhCompletercvServiceImpl
 * @Author: yanzhiwei
 * @Description:
 * @Date: 2024/5/13 15:21
 */
@Service
public class CustXyhCompleterptServiceImpl extends ServiceImplX<CustXyhCompleterptMapper, CustXyhCompleterptEntity>
        implements CustXyhCompleterptService {

    @Autowired
    private CustXyhViewMapper custXyhViewMapper;

    @Autowired
    private CustXyhCompleterptMapper custXyhCompleterptMapper;
    @Autowired
    private DictItemService dictItemService;


    @Override
    public void synData(LocalDate localDate) {
        List<CustXyhCompleterptEntity> data = custXyhViewMapper.listCompleterptView(localDate);
        data.stream().forEach(x -> x.setId(IdWorker.getIdStr()));
        baseMapper.deleteAll();
        saveBatch(data);
    }
}
